package cn.cloud9;

public class Demo6GetEvenSumByFor {

    /**
     * https://www.bilibili.com/video/BV18J411W7cE?p=42
     * 求偶数和
     * @param args
     */
    public static void main(String[] args) {
        int evenSum = 0;
        final int BEGIN = 1;
        final int END = 100;
        for (int i = BEGIN; i <= END ; i++) if (i % 2 == 0) evenSum += i;
        System.out.println("从" + BEGIN + "加到" + END + "的偶数之和 合计值：" + evenSum);
    }
}
